package com.itheima.Timer;

import java.util.Timer;
import java.util.TimerTask;

class Task extends TimerTask {
    @Override
    public void run() {
        System.out.println("running...");
    }
}
public class TimerDemo {
    public static void main(String[] args) {
        Timer t=new Timer();
        //在1秒后执行,以后每2秒跑一次
        t.schedule(new Task(), 1000,2000);
    }
}